package com.beadwallet.alarm;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.RestTemplate;

/**
 * @author master
 */
//@EnableDiscoveryClient
@SpringBootApplication
@Controller
@ComponentScan("com.beadwallet")
public class AlarmServiceApplication extends SpringBootServletInitializer {

	private static final Logger logger = LoggerFactory.getLogger(AlarmServiceApplication.class);

	@RequestMapping("/")
	public String index() {
		return "redirect:/doc.html";
	}

	@Bean
	@LoadBalanced
	RestTemplate restTemplate() {
		return new RestTemplate();
	}

	public static void main(String[] args) throws InterruptedException {
		logger.warn("启动alarm服务");
		new SpringApplicationBuilder(AlarmServiceApplication.class).web(true).run(args);
		logger.warn("启动alarm服务完毕");
	}

}
